#ifndef QMISSION_H
#define QMISSION_H

#include "qabstractdriver.h"

#include <QObject>
#include <QDateTime>
#include <QMap>

enum enMissionStatus
{
    MS_READY,
    MS_RETRY,
    MS_RUNNING,
    MS_DONE,
    MS_DELETE,
    MS_NONE
};

class QMission : public QObject
{
    Q_OBJECT
public:
    explicit QMission(QObject *parent = 0);
    ~QMission();
    
    void    set_send_buffer(const QByteArray& data);
    QByteArray  get_send_buffer();

    void    set_recv_buffer(const QByteArray& data);
    QByteArray get_recv_buffer();

    int     get_address();
    int     get_length();
    int     get_level();
    int     get_machine_address();
    int     get_period();
    QString get_uuid();
    enDataTpye   get_mission_type();
    QString add_address_inforamtion(tagDriverDataInfo *info);
    bool    remove_address_information(const QString &uuid);

    void    set_mission_status(enMissionStatus status);
    enMissionStatus get_mission_status();

    void    ready();

    double    get_todo();

    void    set_max_read(int read);
    void    set_max_write(int write);

    QMap<QString,tagDriverDataInfo*> get_address_info();
    void    set_last_time(QDateTime time);
protected:
    void    update();
signals:
    
public slots:
protected:
    int     m_address;
    int     m_length;
    int     m_period;
    int     m_level;
    int     m_machine_address;
    QString m_uuid;

    QByteArray  m_send_buffer;
    QByteArray  m_recv_buffer;

    enDataTpye   m_mission_type;
    enMissionStatus m_mission_status;

    QDateTime   m_last_time;

    QMap<QString,tagDriverDataInfo*>   m_address_info;

    int                 m_max_read;
    int                 m_max_write;
};

#endif // QMISSION_H
